<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	</head>
	<body>
		<div>FP测试</div>
    <input placeholder="输入测试"></input>
    <img src="https://www.baidu.com/img/flexible/logo/pc/result.png" alt="baidu"/>
	</body>
	<script>
    
		const entryHandler = (list) => {
			for (const entry of list.getEntries()) {
				if (entry.name === 'first-paint') {
					observer.disconnect()
					console.log('entry', entry)
				}
			}
		}
		// 统计和计算fp的时间
		const observer = new PerformanceObserver(entryHandler)
		// buffered: true 确保观察到所有paint事件
		observer.observe({ type: 'paint', buffered: true })
	</script>
</html>
